package com.dly.hope.modle;

import com.dly.hope.type.MessageType;
import com.dly.hope.type.SessionType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.common.util.StringHelper;

import javax.persistence.*;

/**
 * @author linyu.dai
 * @project myserve
 * @description 用来保存webSocket的信息
 * @creat 2022/11/7 16:09:44
 */
@Entity
@Table(name = "hope009_websocket_message")
@DynamicInsert
@DynamicUpdate

@Data
@NoArgsConstructor
@AllArgsConstructor
public class WebSocketMessage extends BaseEntity{

    @Id
    @Column(name = "id")
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "org.hibernate.id.UUIDGenerator")
    private String id;

    @Column(name = "send_id")
    @Comment(value = "发送人")
    private String sendId;

    @Column(name = "accept_id")
    @Comment(value = "接收人")
    private String acceptId;

    @Column(name = "message")
    @Comment(value = "消息")
    private String message;

    @Column(name = "message_Type")
    @Comment(value = "消息类型")
    @Enumerated(EnumType.STRING)
    private MessageType messageType;

    @Column(name = "session_Type")
    @Comment(value = "会话类型")
    @Enumerated(EnumType.STRING)
    private SessionType sessionType;

    @Column(name = "is_read")
    @Comment(value = "是否已读")
    private Boolean isRead = Boolean.FALSE;
}
